package kr.hkit.powerjava.chapter21.Programming;

public class BankAccount {

	private int balance = 0;//잔액
	
	public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		this.balance = balance;
	}

	public void deposit(int money){//입금
		balance += money;
	}
	
	public void withdraw(int money) throws NegativeBalanceException{
		if(money > balance){//출금할때 출금할 돈이 더 크면 예외현상 발생
			throw new NegativeBalanceException();
		}else{
			balance -= money;
		}
	}
	
	
}
